;; This function is used in various programming language mode hooks below.  It
;; does indentation after every newline when writing a program.

(defun newline-indent ()
  "Bind Return to `newline-and-indent' in the local keymap."
  (local-set-key "\C-m" 'newline-and-indent))


;; Tell Emacs to use the function above in certain editing modes.

(add-hook 'lisp-mode-hook             (function newline-indent))
(add-hook 'emacs-lisp-mode-hook       (function newline-indent))
(add-hook 'lisp-interaction-mode-hook (function newline-indent))
(add-hook 'scheme-mode-hook           (function newline-indent))
(add-hook 'c-mode-hook                (function newline-indent))
(add-hook 'c++-mode-hook              (function newline-indent))
